<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
<script src="../AngularJS/angular-1.5.0/angular.min.js"></script>
		<title></title>
	</head>
	<body ng-app="myapp">
		<div ng-controller="myctrl">
			
			<drink flavor="{{ctrlFlavor}}"></drink>
		</div>
<script>
	var app = angular.module("myapp",[]);
	app.controller("myctrl",function($scope){
		 $scope.ctrlFlavor="百威";
	});
	app.directive("drink",function(){
		return{
			restrict:"AE",
//			scope:{
//				flavor:"@",//字符串传递
//			},
			template:'<div>{{flavor}}</div>',
			link:function(scope,element,attrs){
				scope.flavor=attrs.flavor;
			}
			
		}
	});
</script>
	</body>
</html>
